package net.lizhongxian.interview.hunktimes.entity;

import java.math.BigDecimal;

/**
 * 优惠券类
 */
public class Coupon {

	/**
	 * 满减所需的价格
	 */
	private final BigDecimal demand;

	/**
	 * 满减价格
	 */
	private final BigDecimal reduction;

	/**
	 * 是否只能单独使用
	 */
	private final boolean isExclusive;

	/**
	 * 创建新的优惠券，默认只能单独使用
	 *
	 * @param demand    满减所需的价格
	 * @param reduction 满减价格
	 */
	public Coupon(BigDecimal demand, BigDecimal reduction) {
		this.demand = demand;
		this.reduction = reduction;
		this.isExclusive = true;
	}

	/**
	 * 创建新的优惠券
	 *
	 * @param demand      满减所需的价格
	 * @param reduction   满减价格
	 * @param isExclusive 是否只能单独使用
	 */
	public Coupon(BigDecimal demand, BigDecimal reduction, boolean isExclusive) {
		this.demand = demand;
		this.reduction = reduction;
		this.isExclusive = isExclusive;
	}

	public BigDecimal getDemand() {
		return demand;
	}

	public BigDecimal getReduction() {
		return reduction;
	}

	public boolean isExclusive() {
		return isExclusive;
	}

	@Override
	public String toString() {
		return "Coupon{" +
				"demand=" + demand +
				", reduction=" + reduction +
				", isExclusive=" + isExclusive +
				'}';
	}
}
